package com.iplay.dahua.chapter2.simpleFactory;

/**
 * 返利收费子类
 * @author dangwu
 * @since 2021/7/21 3:03 下午
 */
public class CashReturn extends BaseCashSuper{

    private double moneyCondition;
    private double moneyReturn;

    public CashReturn (double moneyCondition,double moneyReturn){
        this.moneyCondition = moneyCondition;
        this.moneyReturn = moneyReturn;
    }

    @Override
    public double acceptCash(double money) {
        double result = money;
        if (result >= moneyCondition){
            return result - moneyReturn;
        }
        return result;
    }
}
